package com.broada.apm.logic;

import java.util.Date;
import java.util.List;
import java.util.Set;

import com.broada.apm.entity.TradePerformance;
import com.broada.apm.model.PagingList;
import com.broada.apm.model.PerformanceView;

public interface TradePerformanceLogic {
	public List<PerformanceView> getTradesPerformancesTotal(String appId, String nodeId, String vsite, String orderBy,
			boolean desc, String keyWord, String tradeIp, String tradeProto, Date startDate, Date endDate, int top);

	public List<TradePerformance> getKeyTradePerformanceSubTotal(String appId, String keyWord, Date startDate,
			Date endDate);

	public PagingList<PerformanceView> getTrackingTradesPerformances(String appId,String agentId, String keyWord, String transactionType, String transactionChannel, long startDate,
			long endDate, int pageSize, int pageIndex, String sortBy, boolean desc, String slowTransaction) throws Exception;
	
	public List<PerformanceView> getMultiStatistics(Set<String> agentIds, String keyWord, String transactionType, String transactionChannel, String destIp, String srcIp, 
			String responseCode, long startDate, long endDate, String sortBy, String groupBy, boolean desc) throws Exception;

	public List<TradePerformance> tradeAllType(String appId, String agentId,String type, String keyWord, String orderBy, boolean desc, Date startDate,
			Date endDate, Integer size) throws Exception;

	public PerformanceView transactionDetail(String spanId, long startDate, long endDate) throws Exception;


	
	/**
	 * 查询最慢HTTP页面排行
	 * @param appId
	 * @param top
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<PerformanceView> getHttpSlowSort(String appId, int top, Date startDate, Date endDate);
	
	/**
	 * 错误HTTP页面排行
	 * @param appId
	 * @param top
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<PerformanceView> getHttpErrorSort(String appId, int top, Date startDate, Date endDate);
	
	/**
	 * 最慢SQL排行
	 * @param appId
	 * @param top
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<PerformanceView> getSqlSlowSort(String appId, int top, Date startDate, Date endDate);
	
	/**
	 * 错误SQL页面排行
	 * @param appId
	 * @param top
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<PerformanceView> getSqlErrorSort(String appId, int top, Date startDate, Date endDate);

	/**
	 * 银监会，根据监测指标统计
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<PerformanceView> getTradeMergeByStability(String termBy, Date startDate, Date endDate);

	/**
	 * 获取某个节点的所有交易类型及交易渠道
	 * @param appId
	 * @param serviceId
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<PerformanceView> getChannelAndTypeByService(String appId, Set<String> serviceIdsSet, Date startDate, Date endDate);

	public List<PerformanceView> getTopTradeType(String subTermBy, int top, Date startDate, Date endDate, 
			Set<String> appIdsSet);
}
